﻿using System;
namespace ComponentSystem
{
    /// <summary>
    /// 组件带ID
    /// </summary>
    public abstract class ComponentWithId : Component
    {
        /// <summary>
        /// 类构造函数
        /// </summary>
        protected ComponentWithId() : base()
        {
        }

        /// <summary>
        /// 带ID构造函数
        /// </summary>
        protected ComponentWithId(long id)
        {
            Constructor(id);
        }

        /// <summary>
        /// 自定义构造函数
        /// </summary>
        protected override void Constructor()
        {
            base.Constructor();
        }

        /// <summary>
        /// 带ID自定义构造函数
        /// </summary>
        protected virtual void Constructor(long id)
        {
            this.InstanceId = id;
            this.Awake();
            this.Start();
            this.UpdateState(UniversalEnum.State.IsInited);
        }

    }
}